#ifndef ATTENDANCEINQUIRY_H
#define ATTENDANCEINQUIRY_H

#include <QWidget>
#include <QStandardItemModel>
#include <QTableView>
#include <QLineEdit>
#include <QDateEdit>
#include <QPushButton>
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QFormLayout>

class AttendanceInquiry : public QWidget
{
    Q_OBJECT

public:
    explicit AttendanceInquiry(QWidget *parent = nullptr);
    ~AttendanceInquiry();

private slots:
    void onQueryButtonClicked();
    void onExportButtonClicked();
    void displayQueryResults(const QJsonArray &records);
    QString queryAttendanceRecords(const QString &employeeID, const QString &name, const QString &yearMonth);
    bool exportToCsv(const QString &filePath, const QJsonArray &records);

private:
    // UI组件
    QLineEdit *idLineEdit;
    QLineEdit *nameLineEdit;
    QDateEdit *dateEdit;
    QPushButton *queryButton;
    QPushButton *exportButton;
    QTableView *tableView;
    QLabel *statusLabel;

    // 数据模型
    QStandardItemModel *m_model;

    // 布局
    void setupUI();
};

#endif // ATTENDANCEINQUIRY_H
